package com.hospital_ssm.service.patient.impl;

import com.hospital_ssm.dao.PatientDao;
import com.hospital_ssm.pojo.Patient;
import com.hospital_ssm.service.patient.PatientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class PatientsServiceImpl implements PatientService {

    @Autowired
    PatientDao patientDao;


    @Override
    public List<Patient> getPatientByAccount(String account) {
        List<Patient> list=null;
        list=patientDao.selectByAccount(account);
        return list;
    }

    @Override
    public int insertPatient(Patient patient) {
        int k=patientDao.insertPatient(patient.getAccount(),patient.getEmail(),patient.getPassword(),patient.getName());
        return k;
    }

    @Override
    public int updatePasswordByaccount(String password,String account) {
        int k=patientDao.updatePasswordByaccount(password,account);
        return k;
    }
}
